package com.tide.crm.service.impl;

import com.tide.crm.dao.ProjectFollowInfoDao;
import com.tide.crm.model.ProjectFollowInfo;
import com.tide.crm.service.ProjectFollowInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * (ProjectFollowInfo)表服务实现类
 *
 * @author makejava
 * @since 2021-03-15 14:17:43
 */
@Service("projectFollowInfoService")
public class ProjectFollowInfoServiceImpl implements ProjectFollowInfoService {

    @Resource
    private ProjectFollowInfoDao projectFollowInfoDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public ProjectFollowInfo queryById(Long id) {
        return this.projectFollowInfoDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<ProjectFollowInfo> queryAllByLimit(int offset, int limit) {
        return this.projectFollowInfoDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param projectFollowInfo 实例对象
     * @return 实例对象
     */
    @Override
    public ProjectFollowInfo insert(ProjectFollowInfo projectFollowInfo) {
        this.projectFollowInfoDao.insert(projectFollowInfo);
        return projectFollowInfo;
    }

    /**
     * 修改数据
     *
     * @param projectFollowInfo 实例对象
     * @return 实例对象
     */
    @Override
    public ProjectFollowInfo update(ProjectFollowInfo projectFollowInfo) {
        this.projectFollowInfoDao.update(projectFollowInfo);
        return this.queryById(projectFollowInfo.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.projectFollowInfoDao.deleteById(id) > 0;
    }

    @Override
    public int count(Map<String, Object> params) {
        return projectFollowInfoDao.count(params);
    }

    @Override
    public List<ProjectFollowInfo> list(Map<String, Object> params, Integer offset, Integer limit) {
        return projectFollowInfoDao.list(params, offset, limit);
    }
}